package edu.intprog.egreeting.beans;

public class Greeting {

	private String _senderName;
	private String _senderEmail;
	private String _recipientName;
	private String _recipientEmail;
	private String _backgroundImage;
	private String _backgroundSound;
	private String _personalBlessing;
	private String _blessing;
	private String _title;
	private String _greetingImage;
	
	public Greeting() {

	}

	public String get_senderName() {
		return _senderName;
	}

	public void set_senderName(String name) {
		_senderName = name;
	}

	public String get_senderEmail() {
		return _senderEmail;
	}

	public void set_senderEmail(String email) {
		_senderEmail = email;
	}

	public String get_recipientName() {
		return _recipientName;
	}

	public void set_recipientName(String name) {
		_recipientName = name;
	}

	public String get_recipientEmail() {
		return _recipientEmail;
	}

	public void set_recipientEmail(String email) {
		_recipientEmail = email;
	}

	public String get_backgroundImage() {
		return _backgroundImage;
	}

	public void set_backgroundImage(String image) {
		_backgroundImage = image;
	}

	public String get_backgroundSound() {
		return _backgroundSound;
	}

	public void set_backgroundSound(String sound) {
		_backgroundSound = sound;
	}

	public String get_personalBlessing() {
		return _personalBlessing;
	}

	public void set_personalBlessing(String blessing) {
		_personalBlessing = blessing;
	}

	public String get_blessing() {
		return _blessing;
	}

	public void set_blessing(String _blessing) {
		this._blessing = _blessing;
	}

	public String get_title() {
		return _title;
	}

	public void set_title(String _title) {
		this._title = _title;
	}

	public String get_greetingImage() {
		return _greetingImage;
	}

	public void set_greetingImage(String image) {
		_greetingImage = image;
	}
	
	public String validate() {
		String errorMessage = new String();
		
		if (_senderName.length()==0)
		{
			errorMessage = errorMessage + "Sender name or nickname is mandatory.<br />";
		}
		
		if (_recipientName.length()==0)
		{
			errorMessage = errorMessage + "Recipient name or nickname is mandatory.<br />";
		}
		
		if (_recipientEmail.length()==0)
		{
			errorMessage = errorMessage + "Recipient E-Mail address is mandatory.<br />";
		}
				
		if (_recipientEmail.matches("(\\w+)@(\\w+\\.)(\\w+)(\\.\\w+)*") == false)
		{
			errorMessage = errorMessage + "Recipient E-Mail address must be of a valid form.<br />";
		}

		return errorMessage;	
	}

}
